<%--
  Created by IntelliJ IDEA.
  User: Tang'ya'kang
  Date: 2023/5/23
  Time: 21:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>AccountPage_Nav</title>
</head>
<body>
<script>
    $(function () {
        $("#jumpBtn").click(function () {
            var Page=$("#jumpInput").val();
            location="${url}"+Page;
        });
    });
</script>

<%--./accountManagementServlet?action=SelectAccountManagementByPage&Page=--%>

<nav aria-label="Page navigation example">
    <ul class="pagination justify-content-center">
        <c:if test="${requestScope.AccountPage.page!=1}">
            <li class="page-item">
                <a class="page-link" href="${url}1">首页</a>
            </li>
            <li class="page-item"><a class="page-link" href="${url}${requestScope.AccountPage.page-1}">上一页</a></li>
        </c:if>
        <c:if test="${requestScope.AccountPage.page==1}">
            <li class="page-item disabled">
                <a class="page-link" href="${url}1">首页</a>
            </li>
            <li class="page-item disabled"><a class="page-link" href="${url}${requestScope.AccountPage.page-1}">上一页</a></li>
        </c:if>

        <c:if test="${requestScope.AccountPage.pageTocal<=5}">
            <c:forEach var="i" begin="1" end="${requestScope.AccountPage.pageTocal}">
                <c:if test="${i!=requestScope.AccountPage.page}">
                    <li class="page-item"><a class="page-link" href="${url}${i}">${i}</a></li>
                </c:if>
                <c:if test="${i==requestScope.AccountPage.page}">
                    <li class="page-item disabled"><a class="page-link" href="${url}${i}">【${i}】</a></li>
                </c:if>
            </c:forEach>
        </c:if>

        <c:if test="${requestScope.AccountPage.pageTocal>5}">
            <c:if test="${requestScope.AccountPage.page<=3}">
                <c:forEach begin="1" end="5" var="i">
                    <c:if test="${i!=requestScope.AccountPage.page}">
                        <li class="page-item"><a class="page-link" href="${url}${i}">${i}</a></li>
                    </c:if>
                    <c:if test="${i==requestScope.AccountPage.page}">
                        <li class="page-item disabled"><a class="page-link" href="${url}${i}">【${i}】</a></li>
                    </c:if>
                </c:forEach>
            </c:if>
            <c:if test="${requestScope.AccountPage.page+2>=requestScope.AccountPage.pageTocal}">
                <c:forEach begin="${requestScope.AccountPage.pageTocal-4}" end="${requestScope.AccountPage.pageTocal}" var="i">
                    <c:if test="${i!=requestScope.AccountPage.page}">
                        <li class="page-item"><a class="page-link" href="${url}${i}">${i}</a></li>
                    </c:if>
                    <c:if test="${i==requestScope.AccountPage.page}">
                        <li class="page-item disabled"><a class="page-link" href="${url}${i}">【${i}】</a></li>
                    </c:if>
                </c:forEach>
            </c:if>
            <c:if test="${requestScope.AccountPage.page>3&&requestScope.AccountPage.page<requestScope.AccountPage.pageTocal-2}">
                <c:forEach begin="${requestScope.AccountPage.page-2}" end="${requestScope.AccountPage.page+2}" var="i">
                    <c:if test="${i!=requestScope.AccountPage.page}">
                        <li class="page-item"><a class="page-link" href="${url}${i}">${i}</a></li>
                    </c:if>
                    <c:if test="${i==requestScope.AccountPage.page}">
                        <li class="page-item disabled"><a class="page-link" href="${url}${i}">【${i}】</a></li>
                    </c:if>
                </c:forEach>
            </c:if>
        </c:if>

        <c:if test="${requestScope.AccountPage.page!=requestScope.AccountPage.pageTocal}">
            <li class="page-item"><a class="page-link" href="${url}${requestScope.AccountPage.page+1}">下一页</a></li>
            <li class="page-item">
                <a class="page-link" href="${url}${requestScope.AccountPage.pageTocal}">末页</a>
            </li>
        </c:if>

        <c:if test="${requestScope.AccountPage.page==requestScope.AccountPage.pageTocal}">
            <li class="page-item disabled"><a class="page-link" href="${url}${requestScope.AccountPage.page+1}">下一页</a></li>
            <li class="page-item disabled">
                <a class="page-link" href="${url}${requestScope.AccountPage.pageTocal}">末页</a>
            </li>
        </c:if>

        <%--                    以下必须的--%>
        <li class="page-item disabled">
            <a class="page-link">共计${requestScope.AccountPage.pageTocal}页,${requestScope.AccountPage.count}条记录   到第</a>
        </li>
        <li class="page-item">
            <input type="text" class="form-control" size="1" id="jumpInput" value="${requestScope.AccountPage.page}">
        </li>
        <li class="page-item">
            <button type="button" class="btn btn-light" id="jumpBtn">页跳转</button>
        </li>
    </ul>
</nav>


</body>
</html>
